﻿Imports FuncClasses
Imports System.Collections.ObjectModel
Imports System.Windows.Controls

Public Class DPDControl
    Public Event RefreshRequested()

    Public Sub SetDetails(ByVal values As Collection(Of KeyValuePairs))
        StackPanelDetails.Children.Clear()
        StackPanelDetails.Children.Add(GridDetailHeader)
        For Each kvp As KeyValuePairs In values
            Dim g As New Grid
            g.Height = 28
            '### Datum - Ort - Text ###'
            'Add Controls with the Content
            Dim l1 As New Label()
            'l1.Width = 133
            l1.Margin = New Windows.Thickness(6, 0, 0, 0)
            l1.Content = kvp.Key

            Dim l2 As New Label()
            'l2.Width = 93
            l2.Margin = New Windows.Thickness(145, 0, 0, 0)
            l2.Content = kvp.Value

            Dim l3 As New Label()
            l3.Margin = New Windows.Thickness(244, 0, 6, 0)
            l3.Content = kvp.Others(0)

            g.Children.Add(l1)
            g.Children.Add(l2)
            g.Children.Add(l3)
            StackPanelDetails.Children.Add(g)
            Expander1.IsExpanded = True
        Next
    End Sub

    Public Sub SetLastState(ByVal kvp As KeyValuePairs)
        Label23.Content = kvp.Key + ": " + kvp.Others(0)
    End Sub

    Private Sub Button4_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button4.Click
        RaiseEvent RefreshRequested()
    End Sub
End Class
